package com.itfenghuang.day03;

import java.util.Random;

//数学工具类
public class A05_Math {
    public static void main(String[] args) {
        /**
         * 1.概念
         *      绝对值
         *      public static int abs(int a)
         *      返回最小的（最接近负无穷大） double值
         *      public static double ceil​(double a)
         *      返回小于或等于参数的最大（最接近正无穷大） double值
         *      public static double floor​(double a)
         *
         */
//        int abs = Math.abs(11);//绝对值
//        System.out.println(abs);
        double ceil = Math.ceil(23.111);//向上取整
        System.out.println(ceil);
        double floor = Math.floor(2.15);//向下取整
        System.out.println(floor);
        int max = Math.max(2, 5);//返回两个数的最大值
        System.out.println(max);
        int min=Math.min(4,8);//返回两个数的最小值
        System.out.println(min);
        double random = Math.random();//随机数 左闭右开 >=0  <1
        System.out.println(random);
        double pow = Math.pow(2,4);//次方
        System.out.println(pow);
        long round = Math.round(3.5);//四舍五入
        System.out.println(round);

        Random random1 = new Random();
        int i = random1.nextInt(4);
        System.out.println(i);


    }
}
